import commonjs from '@rollup/plugin-commonjs';
import typescript from '@rollup/plugin-typescript';
import dts from 'rollup-plugin-dts';
import { nodeResolve } from '@rollup/plugin-node-resolve';
import json from '@rollup/plugin-json';

export default [
    {
        
        input: 'src/index.ts',
        output: [
            {
                file: 'dist/index.js',
                format: 'cjs',
                sourcemap: true
            },
            {
                file: 'dist/index.mjs',
                format: 'es',
                sourcemap: true
            },
            {
                file: 'dist/index.min.js',
                format: 'iife',
                name: 'YFWRequest'
            }
        ],
        plugins: [
            nodeResolve({browser: (outputOptions) => outputOptions.format === 'iife'}),
            commonjs(),
            typescript({
                module: 'ESNext',
            }),
            json()
        ]
    },
    {
        input: 'src/index.ts',
        output: {
            file: 'dist/index.d.ts',
            format: 'es'
        },
        plugins: [
            dts()
        ]
    }
]